<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
    <div class="container-div ui-layout-center">
        <div class="row">
            <div class="col-sm-12 select-info">
                <form id="attendence-form">
                    <div class="select-list">
                        <ul>
                            <!--<li>-->
                                <!--名称：<input type="text" name="name"/>-->
                            <!--</li>-->
                            <!--<li>-->
                                <!--提交人：<input type="text" name="createBy"/>-->
                            <!--</li>-->
                            <li class="select-time">
                                <label>考勤日期： </label>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginTime]"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group hidden-xs" id="toolbar" role="group">
                <a class="btn btn-outline btn-success btn-rounded" onclick="save()" shiro:hasPermission="module:attendence:add">
                    <i class="fa fa-plus"></i> 上班
                </a>
                <a class="btn btn-outline btn-success btn-rounded" onclick="edit()" shiro:hasPermission="module:attendence:edit">
                    <i class="fa fa-edit"></i> 下班
                </a>
                <a class="btn btn-success btn-outline btn-rounded" onclick="$.table.exportExcel()" shiro:hasPermission="module:attendence:export">
                    <i class="fa fa-download"></i>导出
                </a>
            </div>

            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table" data-mobile-responsive="true"></table>
            </div>
        </div>
    </div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var removeFlag = [[${@permission.hasPermi('module:attendence:remove')}]];
        var prefix = ctx + "module/attendence";

        var datas = [[${@dict.getType('attendence_type')}]];

        $(function() {
            var options = {
                url: prefix + "/list",
                // createUrl: prefix + "/add",
                // updateUrl: prefix + "/editSave",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                sortName: "createTime",
                sortOrder: "desc",
                modalName: "考勤管理",
                search: false,
                showExport: false,// 是否支持导出文件
                showRefresh:false,// 是否显示刷新按钮
                showColumns :false,// 是否显示隐藏某列下拉框
                showToggle:false,// 是否显示详细视图和列表视图的切换按钮
                columns: [{
		            checkbox: true
		        },
				{
					field : 'attendId', 
					title : '序号'
				},
				{
					field : 'dutyDay', 
					title : '考勤日期' 
				},
				{
					field : 'createTime', 
					title : '上班时间' 
				},
				{
					field : 'onStatus', 
					title : '上班状态',
                    formatter: function(value, item, index) {
                        return $.table.selectDictLabel(datas, value);
                    }
				},
				{
					field : 'updateTime', 
					title : '下班时间' 
				},
				{
					field : 'offStatus', 
					title : '下班状态',
                    formatter: function(value, item, index) {
                        return $.table.selectDictLabel(datas, value);
                    }
				},
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.attendId + '\')"><i class="fa fa-remove"></i>删除</a>');
						return actions.join('');
		            }
		        }]
            };
            $.table.init(options);
        });
        var prefix = ctx + "module/attendence"
        function save() {
            // $.operate.save(prefix + "/add");
            $.operate.submit(prefix+"/add", "post", "json",null);
        }
        function edit() {
            $.operate.submit(prefix+"/edit", "post", "json",null);
        }

    </script>
</body>
</html>